package com.ryan.mms.privilage.model;

// Generated 2011-11-25 23:17:50 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ryan.framework.model.Model;
import com.ryan.mms.organization.model.Organization;
import com.ryan.mms.position.model.Position;

/**
 * Employee generated by hbm2java
 */
@Entity
@Table(name = "employee")
public class Employee implements Model {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long employeeId;
	private String employeeCode;
	private String employeeName;
	private Organization organization;
	private List<Position> positions;
	private String officeTel;
	private String officePhone;
	private String officeEmail;
	private String homeAddress;
	private String zipCode;
	private String personalTel;
	private String personalPhone;
	private String personalEmail;
	private String idCard;
	private Date birthday;
	private Integer gender;
	private Integer education;
	private String hobby;
	private String specialty;
	private String training;
	private Date regeditDate;
	private Date createTime;
	private Date lastModifyTime;

	public Employee() {
	}

	public Employee(Long employeeId, String employeeCode, String employeeName) {
		this.employeeId = employeeId;
		this.employeeCode = employeeCode;
		this.employeeName = employeeName;
	}

	public Employee(Long employeeId, String employeeCode, String employeeName,
			String officeTel, String officePhone, String officeEmail, String homeAddress,
			String zipCode, String personalTel, String personalPhone,
			String personalEmail, String idCard, Date birthday, Integer gender,
			Integer education, String hobby, String specialty, String training,
			Date regeditDate, Date createTime, Date lastModifyTime) {
		this.employeeId = employeeId;
		this.employeeCode = employeeCode;
		this.employeeName = employeeName;
		this.officeTel = officeTel;
		this.officePhone = officePhone;
		this.officeEmail = officeEmail;
		this.homeAddress = homeAddress;
		this.zipCode = zipCode;
		this.personalTel = personalTel;
		this.personalPhone = personalPhone;
		this.personalEmail = personalEmail;
		this.idCard = idCard;
		this.birthday = birthday;
		this.gender = gender;
		this.education = education;
		this.hobby = hobby;
		this.specialty = specialty;
		this.training = training;
		this.regeditDate = regeditDate;
		this.createTime = createTime;
		this.lastModifyTime = lastModifyTime;
	}

	@Id
	@Column(name = "employee_id", unique = true, nullable = false)
	public Long getEmployeeId() {
		return this.employeeId;
	}

	public void setEmployeeId(Long employeeId) {
		this.employeeId = employeeId;
	}

	@Column(name = "employee_code", nullable = false, length = 12)
	public String getEmployeeCode() {
		return this.employeeCode;
	}

	public void setEmployeeCode(String employeeCode) {
		this.employeeCode = employeeCode;
	}

	@Column(name = "employee_name", nullable = false, length = 50)
	public String getEmployeeName() {
		return this.employeeName;
	}

	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}
	
	@ManyToOne( cascade = {CascadeType.PERSIST}, targetEntity=Organization.class )
	@JoinColumn(name="organization_id")
	public Organization getOrganization() {
		return this.organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}
	
	@ManyToMany (
		targetEntity=Position.class,cascade={CascadeType.PERSIST,CascadeType.MERGE}
	)
	@JoinTable(
		name="employee_position",
		joinColumns={@JoinColumn(name="employee_id")},
		inverseJoinColumns={@JoinColumn(name="position_id")}
	)
    public List<Position> getPositions() {
		return this.positions;
	}

	public void setPositions(List<Position> positions) {
		this.positions = positions;
	}

	@Column(name = "office_tel", length = 15)
	public String getOfficeTel() {
		return this.officeTel;
	}

	public void setOfficeTel(String officeTel) {
		this.officeTel = officeTel;
	}

	@Column(name = "office_phone", length = 15)
	public String getOfficePhone() {
		return this.officePhone;
	}

	public void setOfficePhone(String officePhone) {
		this.officePhone = officePhone;
	}

	@Column(name = "office_email", length = 128)
	public String getOfficeEmail() {
		return this.officeEmail;
	}

	public void setOfficeEmail(String officeEmail) {
		this.officeEmail = officeEmail;
	}

	@Column(name = "home_address", length = 128)
	public String getHomeAddress() {
		return this.homeAddress;
	}

	public void setHomeAddress(String homeAddress) {
		this.homeAddress = homeAddress;
	}

	@Column(name = "zip_code", length = 10)
	public String getZipCode() {
		return this.zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	@Column(name = "personal_tel", length = 15)
	public String getPersonalTel() {
		return this.personalTel;
	}

	public void setPersonalTel(String personalTel) {
		this.personalTel = personalTel;
	}

	@Column(name = "personal_phone", length = 15)
	public String getPersonalPhone() {
		return this.personalPhone;
	}

	public void setPersonalPhone(String personalPhone) {
		this.personalPhone = personalPhone;
	}

	@Column(name = "personal_email", length = 128)
	public String getPersonalEmail() {
		return this.personalEmail;
	}

	public void setPersonalEmail(String personalEmail) {
		this.personalEmail = personalEmail;
	}

	@Column(name = "id_card", length = 30)
	public String getIdCard() {
		return this.idCard;
	}

	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "birthday", length = 19)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Column(name = "gender")
	public Integer getGender() {
		return this.gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	@Column(name = "education")
	public Integer getEducation() {
		return this.education;
	}

	public void setEducation(Integer education) {
		this.education = education;
	}

	@Column(name = "hobby", length = 400)
	public String getHobby() {
		return this.hobby;
	}

	public void setHobby(String hobby) {
		this.hobby = hobby;
	}

	@Column(name = "specialty", length = 400)
	public String getSpecialty() {
		return this.specialty;
	}

	public void setSpecialty(String specialty) {
		this.specialty = specialty;
	}

	@Column(name = "training", length = 800)
	public String getTraining() {
		return this.training;
	}

	public void setTraining(String training) {
		this.training = training;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "regedit_date", length = 19)
	public Date getRegeditDate() {
		return this.regeditDate;
	}

	public void setRegeditDate(Date regeditDate) {
		this.regeditDate = regeditDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", length = 19)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_modify_time", length = 19)
	public Date getLastModifyTime() {
		return this.lastModifyTime;
	}

	public void setLastModifyTime(Date lastModifyTime) {
		this.lastModifyTime = lastModifyTime;
	}

}
